// router.js
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/Home'
Vue.use(Router)

export function createRouter () {
  return new Router({
    mode: 'history',
    routes: [
      // ...
      {
          path:'/',
          name:'home',
          component:Home
      },
      {
          path:'/about',
          name:'about',
          component:()=>import('@/pages/About')
      },
      {
          path:'/posts',
          name:'posts',
          component:()=>import('@/pages/Posts')
      },
      {
          path:'*',
          name:'error404',
          component:()=>import('@/pages/404')
      }
    ]
  })
}